/**
 * 用户api
 */

import {
    http
} from '@/api/service.js'
import {requestInfo} from '@/api/public.js';
/**
 * 获取用户登录消息
 */
export const getLoginUserInfo=()=>{
    return http.get('/main/user',{custom:{auth:true}})
}
export class UserService{
    //单参数编号生成测试
    static updateUser(user) {
        const query = {

        }
        return requestInfo({
            url: '/sys/user',
            method:"PUT",
            params: query,
            data: user,
        });
    }
    static logOut(){
        const query = {

        }
        return requestInfo({
            url: '/logout',
            method:"POST",
            params:query,
        });
    }
    static wxLogin(code){
        const query = {
            code
        }
        return requestInfo({
            url: '/wx/login',
            method:"GET",
            params:query,
            auth: false
        });
    }

    static bindWx(wXCode,userId) {
        const query = {
            wXCode,userId
        }
        return requestInfo({
            url: '/sys/user/bindWx',
            method:"POST",
            params: query,
        });
    }

    static getAllRoles() {
        const query = {}
        return requestInfo({
            url: '/sys/role',
            method:"GET",
            params: query,
            auth:false
        });
    }

    static removeWx(wXCode, userId) {
        const query = {
            wXCode,userId
        }
        return requestInfo({
            url: '/sys/user/removeWx',
            method:"POST",
            params: query,
        });
    }

    static getUser(id) {
        const query = {}
        return requestInfo({
            url: '/sys/user/'+id,
            method:"GET",
            params: query,
        });
    }
}


